package edu.cuit.avatar.接口;

import java.util.ArrayList;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/10 13:55
 */
public class EdibleTest {
    public static void main(String[] args) {
        ArrayList<Object> list = new ArrayList<>();

        list.add(new Apple());
        list.add(new Orange());
        list.add(new Chicken());
        list.add(new Tiger());

        for(var o : list){
            if(o instanceof Edible edible)
                System.out.println(edible.howToEat());

            if(o instanceof Animal animal)
                System.out.println(animal.sound());
        }
    }
}
